/**
 * Created by vincent on 2017/10/12.
 */
moduleDoor.controller("EditDoor", function ($$CambioConfig, $scope, $log, $state, LoadingService, ConstantService, DialogService, EventResource) {
    initPage($scope);
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.submit = function () {
        Alert.confirm(function () {
            if ($scope.editEventForm.$valid) {
                //LoadingService.show();
                EventResource.update($scope.currentData, function (result) {
                    $log.debug("活动更新结果", result);
                    angular.copy(result, $scope.currentEvent);
                    DialogService.close();
                    //LoadingService.hide();
                    Alert.success();
                }, function () {
                    //LoadingService.hide();
                });
            }
        });

    };
});